package com.zzty.txj1.dao;

import com.zzty.txj1.entity.Sport;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface SportDao {
    @Select("select * from sport where id=#{id}")
    Sport getSportById(Sport sport);

    @Select("select * from sport where userId=#{userId} and date=#{date}")
    Sport getSportByUserIdAndDate(Sport sport);

    @Insert("insert into sport (userId,date) values(#{userId},#{date})")
    Integer initInformation(Sport sport);

    @Update("update sport set startTime=#{startTime} where userId=#{userId} and date=#{date}")
    Integer updateStartTime(Sport sport);

    @Update("update sport set middleTime=#{middleTime} where userId=#{userId} and date=#{date}")
    Integer updateMiddleTime(Sport sport);

    @Update("update sport set finishTime=#{finishTime} where userId=#{userId} and date=#{date}")
    Integer updateFinishTime(Sport sport);

    @Update("update sport set spendTime=#{spendTime} where userId=#{userId} and date=#{date}")
    Integer updateSpendTime(Sport sport);

    @Update("update sport set img1=#{img1} where userId=#{userId} and date=#{date}")
    Integer updateImg1(Sport sport);

    @Update("update sport set img2=#{img2} where userId=#{userId} and date=#{date}")
    Integer updateImg2(Sport sport);


}
